package com.stone.inventory.core.domain.entity;

import com.sun.istack.internal.NotNull;
import io.choerodon.mybatis.annotation.ModifyAudit;
import io.choerodon.mybatis.annotation.VersionAudit;
import io.choerodon.mybatis.domain.AuditDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@ApiModel("库存")
@VersionAudit
@ModifyAudit
@Table(name = "o2inv_stock_level")
@Data
public class StockLevel extends AuditDomain {

    public static final String FIELD_POS_ID = "stockLevelId";
    public static final String FIELD_SKU_ID = "skuId";
    public static final String FIELD_POS_CODE = "posCode";
    public static final String FIELD_SKU_CODE = "skuCode";

    @ApiModelProperty("表ID，主键，供其他表做外键")
    @Id
    @GeneratedValue
    private Long stockLevelId;

    @ApiModelProperty(value = "服务点code")
    @NotBlank
    private String posCode;

    @ApiModelProperty(value = "sku商品")
    @NotBlank
    private String skuCode;

    @ApiModelProperty(value = "初始量")
    @NotNull
    private Long initialAts;

    @ApiModelProperty(value = "现有量")
    @NotNull
    private Long onHand;

    @ApiModelProperty(value = "保留量")
    @NotNull
    private Long reserved;

    @ApiModelProperty(value = "上次修改时间")
    @NotNull
    private Date lastModifiedTime;

    @ApiModelProperty(value = "上次全量时间戳")
    private Long lastFullTimestamp;

}